import React from 'react';
import { Modal, Form } from 'antd';
import { formatMessage } from 'umi';

import cn from 'classnames';
import { FORM_DEFAULT_LAYOUT } from '../config';
import styles from './index.less';

export const showUnRestartModal = ({ title = '重新发起', parentTaskName = '', parentTaskNo = '' }) => {
    const content = (
        <Form {...FORM_DEFAULT_LAYOUT} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
            <div style={{ lineHeight: 1.5, textAlign: 'center', fontSize: 16, marginBottom: 24, marginTop: 16 }}>
                上一级任务已结束，当前任务无法重新发起
            </div>
            <Form.Item label="上一级任务名称">
                <div style={{ lineHeight: 1.5, padding: '10px 0 0' }}>{parentTaskName}</div>
            </Form.Item>
            <Form.Item label="上一级任务编号">{parentTaskNo}</Form.Item>
        </Form>
    );

    Modal.confirm({
        title,
        width: 640,
        content,
        className: cn(styles.confirmModal, styles.hasNoFirstBtn),
        okText: formatMessage({ id: 'btn.form.confirm' }),
        cancelText: formatMessage({ id: 'btn.form.cancel' })
    });
};
